package com.tarena.lbs.basic.web.repository.impl;

import com.tarena.lbs.basic.web.mapper.TagLibraryMapper;
import com.tarena.lbs.basic.web.repository.TagLibraryRepository;
import com.tarena.lbs.common.basic.converter.TagLibraryConverter;
import com.tarena.lbs.pojo.basic.bo.TagLibraryBO;
import com.tarena.lbs.pojo.basic.dos.TagLibraryDO;
import com.tarena.lbs.pojo.basic.query.TagLibraryQuery;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class TagLibraryRepositoryImpl implements TagLibraryRepository {
    @Autowired
    private TagLibraryMapper tagLibraryMapper;

    @Autowired
    private TagLibraryConverter tagLibraryConverter;

    @Override
    public void insert(TagLibraryDO dictItemDO) {
        tagLibraryMapper.insert(dictItemDO);
    }

    @Override
    public TagLibraryBO detail(Integer id) {
        TagLibraryDO tagLibraryDO = tagLibraryMapper.selectByPrimaryKey(id);
        return tagLibraryConverter.do2bo(tagLibraryDO);
    }

    @Override
    public void update(TagLibraryDO record) {
        tagLibraryMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public void delete(Integer id) {
        tagLibraryMapper.deleteByPrimaryKey(id);
    }

    @Override
    public List<TagLibraryDO> selectByCondition(TagLibraryQuery tagLibraryQuery) {
        List<TagLibraryDO> tagLibraryDOS = tagLibraryMapper.selectByCondition(tagLibraryQuery);
        return  tagLibraryDOS;
    }
}
